<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	//获取商品
	String bgiId = request.getParameter("bgiId");
	String bgiName = java.net.URLDecoder.decode(request.getParameter("bgiName") , "UTF-8"); 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>商品管理-文章关联</title>
		<jsp:include page="../../include/base.jsp"></jsp:include>
		<jsp:include page="../../include/common.jsp"></jsp:include>
		<jsp:include page="../../include/baseManage.jsp"></jsp:include>
		<script type="text/javascript">
		var bgiId = "<%=bgiId%>";
		var bgiName = "<%=bgiName%>";
	</script>
	</head>
	<body>
		<div class="mini-toolbar"
			style="border: 0; font-size: 12px; padding-left: 6px;">
			<!-- 操作面板 -->
			<div class="operatePanel">
				<input class="mini-button" text="刷新" iconCls="icon-btn-refresh"
					plain="false" onclick="GoodsArticlesHandler.afresh" />
				<input class="mini-button" text="返回商品列表" iconCls="icon-btn-return"
					plain="false" onclick="GoodsArticlesHandler.returnGoods" />
			</div>
			<div id="queryArticlesDiv" style="height: 24px; margin: 6px 0 2px;">
				<form id="goodsQueryForm">
					<label class="queryPanelLbl">
						文章分类：
					</label>
					<input id="queryBagTree" name="queryBagTree"
						class="mini-treeselect" popupWidth="160" valueField="bagId"
						parentField="bagParent" textField="bagName" width="130"
						url="<%=path%>/getBagTreeSelect.do?type=query" value="-1" />
					<label class="queryPanelLbl">
						文章标题：
					</label>
					<input class="mini-textbox" id="query_baiTitle" />
					<label class="queryPanelLbl">
						文章状态：
					</label>
					<input class="mini-combobox" id="query_baiState" textField="text"
						valueField="id" />
					<input class="mini-button" text="查询" iconCls="icon-btn-search"
						plain="false" onclick="GoodsArticlesHandler.doQueryArticles" />
			</div>
		</div>
		<div class="mini-fit" id="articlePanel">
			<div class="mini-panel" title="<%=bgiName%>的关联文章"
				style="width: 100%; height: 100%;"
				borderStyle="border-bottom:0px;border-left:0px;border-right:0px;">
				<table align="center" style="margin-top: 20px;">
					<tr>
						<td>
							<div id="selectGrid" class="mini-datagrid" fitColumns="true"
								multiSelect="true" pageSize="20" idField="baiId"
								showPageSize="false" showTotalCount="false"
								allowSortColumn="false" virtualScroll="true"
								url="<%=path%>/getBaiList.do"
								style="width: 400px; height: 350px;">
								<div property="columns">
									<div type="checkcolumn" width="40">
									</div>
									<div field="baiTitle" name="baiTitle" width="100%"
										headerAlign="center" allowSort="true">
										可选文章
									</div>
								</div>
							</div>
						</td>
						<td style="width: 80px; text-align: center; font-size: 12px">
							选择
							<br />
							<input type="button" value=">" onclick="add()"
								style="width: 50px;" />
							<br />
							全选
							<br />
							<input type="button" value=">>" onclick="addAll()"
								style="width: 50px;" />
							<br />
						</td>
						<td>
							<div id="selectedGrid" class="mini-datagrid" fitColumns="true"
								multiSelect="true" pageSize="20" idField="baiId"
								showPageSize="false" showTotalCount="false"
								allowSortColumn="false" virtualScroll="true"
								url="<%=path%>/getArticlesList.do"
								style="width: 400px; height: 350px;">
								<div property="columns">
									<div type="indexcolumn" width="40" headerAlign="center">
										序号
									</div>
									<div field="baiTitle" name="baiTitle" width="100%"
										headerAlign="center" allowSort="true">
										已选文章
									</div>
									<div field="operation" name="operation" width="80"
										headerAlign="center" align="center"
										renderer="onActionArticles">
										操作
									</div>
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td
							style="width: 50px; text-align: center; vertical-align: bottom"
							colspan="3">
							<input type="button" value="保存" onclick="saveItems()"
								style="width: 55px;" />
						</td>
					</tr>
				</table>
			</div>
		</div>
	</body>
	<script src="handler/GoodsArticlesHandler.js" type="text/javascript"></script>
</html>